from gradio_client import Client
import gradio


curl - N http: // 2erl.prod-bd-wx-if .apps.gitee-ai.com/call/predict/a4516324af18430dbacf75dcdef90c60?sign = eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJodHRwczovL2FpLmdpdGVlLmNvbSIsInN1YiI6IntcIm5hbWVzcGFjZVwiOlwic3RyaW5naWZ5XCIsXCJwcm9qZWN0XCI6XCJJbmRleC0xLjlCLWJpMTAwXCIsXCJhcHBJZFwiOlwiMmVybFwifSIsImV4cCI6MTcyMzk3Nzk2OH0.fNA8B3XY7Scpaqz_9n-s0tQi_Vo1OovSw65mf2CboCWbXKYhEF4xmXMkBK7BIyVwDGrktcG0q5g8Z5lSRcC5Aw

curl - X POST http: // 2erl.prod-bd-wx-if .apps.gitee-ai.com/call/generate /?sign = eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJodHRwczovL2FpLmdpdGVlLmNvbSIsInN1YiI6IntcIm5hbWVzcGFjZVwiOlwic3RyaW5naWZ5XCIsXCJwcm9qZWN0XCI6XCJJbmRleC0xLjlCLWJpMTAwXCIsXCJhcHBJZFwiOlwiMmVybFwifSIsImV4cCI6MTcyMzk3Nzk2OH0.fNA8B3XY7Scpaqz_9n-s0tQi_Vo1OovSw65mf2CboCWbXKYhEF4xmXMkBK7BIyVwDGrktcG0q5g8Z5lSRcC5Aw \
    - H "Content-Type: application/json" \
     - d '{
         "data": [{
             "chat_history": [],
             "query": "Hello!!",
             "top_k": 5,
             "top_p": 0.8,
             "temperature": 0.3,
             "repetition_penalty": 1.1,
             "max_dec_len": 2048,
             "system_message": "请你扮演B站老哥, 用评论区阴阳怪气话术回复, 不要说你是 AI"
         }]
     }'


print(gradio.__version__)
client = Client(
    "http://2erl.prod-bd-wx-if.apps.gitee-ai.com/?sing=eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJodHRwczovL2FpLmdpdGVlLmNvbSIsInN1YiI6IntcIm5hbWVzcGFjZVwiOlwic3RyaW5naWZ5XCIsXCJwcm9qZWN0XCI6XCJJbmRleC0xLjlCLWJpMTAwXCIsXCJhcHBJZFwiOlwiMmVybFwifSIsImV4cCI6MTcyMzk3Nzk2OH0.fNA8B3XY7Scpaqz_9n-s0tQi_Vo1OovSw65mf2CboCWbXKYhEF4xmXMkBK7BIyVwDGrktcG0q5g8Z5lSRcC5Aw")
client.cookies = {"sign": "eyJhbGciOiJFZERTQSJ9.eyJpc3MiOiJodHRwczovL2FpLmdpdGVlLmNvbSIsInN1YiI6IntcIm5hbWVzcGFjZVwiOlwic3RyaW5naWZ5XCIsXCJwcm9qZWN0XCI6XCJJbmRleC0xLjlCLWJpMTAwXCIsXCJhcHBJZFwiOlwiMmVybFwifSIsImV4cCI6MTcyMzk3Nzk2OH0.fNA8B3XY7Scpaqz_9n-s0tQi_Vo1OovSw65mf2CboCWbXKYhEF4xmXMkBK7BIyVwDGrktcG0q5g8Z5lSRcC5Aw"}
print(client.config.get("url"))
print("开始")
result = client.predict(
    chat_history=[],
    query="Hello!!",
    top_k=5,
    top_p=0.8,
    temperature=0.3,
    repetition_penalty=1.1,
    max_dec_len=2048,
    system_message="请你扮演B站老哥, 用评论区阴阳怪气话术回复, 不要说你是 AI",
    api_name="/generate"
)
print(result)
